﻿using System.ServiceModel;
using Framework.Remoting.Conventions;
using Xunit;

namespace Framework.Tests.Wcf.Conventions
{
    public class ProtocolFactoryTest
    {
        private readonly IProtocolFactory target = new ProtocolFactory();

        [Fact]
        public void When_Protocol_Not_exists_for_Binding_Then_Exception_ProtocolNotFoundException()
        {
            Assert.Throws<ProtocolNotFoundException>(() => target.Create(new BasicHttpsBinding()));
        }

        [Fact]
        public void When_Binding_is_NetTcpBinding_Then_Protocol_is_nettcp()
        {
            Assert.Equal("net.tcp", target.Create(new NetTcpBinding()));
        }
    }
}